package cn.ibizlab.odoo.core.odoo_maintenance.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Imaintenance_equipment;
import cn.ibizlab.odoo.core.odoo_maintenance.domain.Maintenance_equipment;
import cn.ibizlab.odoo.core.odoo_maintenance.filter.Maintenance_equipmentSearchContext;
import cn.ibizlab.odoo.core.odoo_maintenance.service.IMaintenance_equipmentService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[保养设备] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Maintenance_equipmentServiceImpl implements IMaintenance_equipmentService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Imaintenance_equipmentClientService maintenance_equipmentClientService;

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Imaintenance_equipment clientModel = maintenance_equipmentClientService.createModel();
        clientModel.setId(id);
        maintenance_equipmentClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public Maintenance_equipment get(Integer id) {
        Imaintenance_equipment clientModel = maintenance_equipmentClientService.createModel();
        clientModel.setId(id);
        maintenance_equipmentClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Maintenance_equipment get(Maintenance_equipment maintenance_equipment) {
        Maintenance_equipment retmaintenance_equipment = this.get(maintenance_equipment.getId()) ;
    	BeanCopier copier=BeanCopier.create(retmaintenance_equipment.getClass(), maintenance_equipment.getClass(), false);
        copier.copy(retmaintenance_equipment, maintenance_equipment, null);
        return maintenance_equipment ;
    }

    @Override
    public void createBatch(List<Maintenance_equipment> maintenance_equipments, int batchSize) {

                        //maintenance_equipmentClientService.createBatch(maintenance_equipments,batchSize) ;

    }

    @Override
    public void updateBatch(List<Maintenance_equipment> maintenance_equipments, int batchSize) {

        //maintenance_equipmentClientService.updateBatch(maintenance_equipments,batchSize) ;

    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //maintenance_equipmentClientService.removeBatch(maintenance_equipments) ;

    }

    @Override
    public boolean create(Maintenance_equipment maintenance_equipment) {
        boolean bOk = false ;
        Imaintenance_equipment clientModel = this.convert2Model(maintenance_equipment,null);
        maintenance_equipmentClientService.create(clientModel) ;
        this.convert2Domain(clientModel,maintenance_equipment);
        bOk = true ;

        return bOk ;
    }

    @Override
    public boolean update(Maintenance_equipment maintenance_equipment) {
        boolean bOk = false ;
        Imaintenance_equipment clientModel = this.convert2Model(maintenance_equipment,null);
        maintenance_equipmentClientService.update(clientModel) ;
        this.convert2Domain(clientModel,maintenance_equipment) ;
        bOk = true;
        return bOk ;
    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Maintenance_equipment> searchDefault(Maintenance_equipmentSearchContext context) {
        List<Maintenance_equipment> list = new ArrayList<Maintenance_equipment>();
        Page<cn.ibizlab.odoo.core.client.model.Imaintenance_equipment> clientModelList = maintenance_equipmentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Imaintenance_equipment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Maintenance_equipment>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据HR 部门查询
     */
    @Override
    public Page<Maintenance_equipment> selectByOdoo_department(Integer id){
        Maintenance_equipmentSearchContext context = new Maintenance_equipmentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Maintenance_equipment> list = new ArrayList<Maintenance_equipment>();
        Page<cn.ibizlab.odoo.core.client.model.Imaintenance_equipment> clientModelList = maintenance_equipmentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Imaintenance_equipment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Maintenance_equipment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据员工查询
     */
    @Override
    public Page<Maintenance_equipment> selectByOdoo_employee(Integer id){
        Maintenance_equipmentSearchContext context = new Maintenance_equipmentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Maintenance_equipment> list = new ArrayList<Maintenance_equipment>();
        Page<cn.ibizlab.odoo.core.client.model.Imaintenance_equipment> clientModelList = maintenance_equipmentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Imaintenance_equipment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Maintenance_equipment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据维护设备类别查询
     */
    @Override
    public Page<Maintenance_equipment> selectByOdoo_category(Integer id){
        Maintenance_equipmentSearchContext context = new Maintenance_equipmentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Maintenance_equipment> list = new ArrayList<Maintenance_equipment>();
        Page<cn.ibizlab.odoo.core.client.model.Imaintenance_equipment> clientModelList = maintenance_equipmentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Imaintenance_equipment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Maintenance_equipment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据保养团队查询
     */
    @Override
    public Page<Maintenance_equipment> selectByOdoo_maintenance_team(Integer id){
        Maintenance_equipmentSearchContext context = new Maintenance_equipmentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Maintenance_equipment> list = new ArrayList<Maintenance_equipment>();
        Page<cn.ibizlab.odoo.core.client.model.Imaintenance_equipment> clientModelList = maintenance_equipmentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Imaintenance_equipment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Maintenance_equipment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据公司查询
     */
    @Override
    public Page<Maintenance_equipment> selectByOdoo_company(Integer id){
        Maintenance_equipmentSearchContext context = new Maintenance_equipmentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Maintenance_equipment> list = new ArrayList<Maintenance_equipment>();
        Page<cn.ibizlab.odoo.core.client.model.Imaintenance_equipment> clientModelList = maintenance_equipmentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Imaintenance_equipment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Maintenance_equipment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Maintenance_equipment> selectByOdoo_partner(Integer id){
        Maintenance_equipmentSearchContext context = new Maintenance_equipmentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Maintenance_equipment> list = new ArrayList<Maintenance_equipment>();
        Page<cn.ibizlab.odoo.core.client.model.Imaintenance_equipment> clientModelList = maintenance_equipmentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Imaintenance_equipment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Maintenance_equipment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Maintenance_equipment> selectByOdoo_create(Integer id){
        Maintenance_equipmentSearchContext context = new Maintenance_equipmentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Maintenance_equipment> list = new ArrayList<Maintenance_equipment>();
        Page<cn.ibizlab.odoo.core.client.model.Imaintenance_equipment> clientModelList = maintenance_equipmentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Imaintenance_equipment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Maintenance_equipment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Maintenance_equipment> selectByOdoo_owner_user(Integer id){
        Maintenance_equipmentSearchContext context = new Maintenance_equipmentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Maintenance_equipment> list = new ArrayList<Maintenance_equipment>();
        Page<cn.ibizlab.odoo.core.client.model.Imaintenance_equipment> clientModelList = maintenance_equipmentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Imaintenance_equipment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Maintenance_equipment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Maintenance_equipment> selectByOdoo_technician_user(Integer id){
        Maintenance_equipmentSearchContext context = new Maintenance_equipmentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Maintenance_equipment> list = new ArrayList<Maintenance_equipment>();
        Page<cn.ibizlab.odoo.core.client.model.Imaintenance_equipment> clientModelList = maintenance_equipmentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Imaintenance_equipment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Maintenance_equipment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Maintenance_equipment> selectByOdoo_write(Integer id){
        Maintenance_equipmentSearchContext context = new Maintenance_equipmentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Maintenance_equipment> list = new ArrayList<Maintenance_equipment>();
        Page<cn.ibizlab.odoo.core.client.model.Imaintenance_equipment> clientModelList = maintenance_equipmentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Imaintenance_equipment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Maintenance_equipment>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Imaintenance_equipment convert2Model(Maintenance_equipment domain , Imaintenance_equipment model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = maintenance_equipmentClientService.createModel() ;
        }

         if(domain.getActivity_summaryDirtyFlag())
            model.setActivity_summary(domain.getActivity_summary());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getActivity_idsDirtyFlag())
            model.setActivity_ids(domain.getActivity_ids());
         if(domain.getMessage_needaction_counterDirtyFlag())
            model.setMessage_needaction_counter(domain.getMessage_needaction_counter());
         if(domain.getMessage_unreadDirtyFlag())
            model.setMessage_unread(domain.getMessage_unread());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getEquipment_assign_toDirtyFlag())
            model.setEquipment_assign_to(domain.getEquipment_assign_to());
         if(domain.getLocationDirtyFlag())
            model.setLocation(domain.getLocation());
         if(domain.getWarranty_dateDirtyFlag())
            model.setWarranty_date(domain.getWarranty_date());
         if(domain.getWebsite_message_idsDirtyFlag())
            model.setWebsite_message_ids(domain.getWebsite_message_ids());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getMaintenance_durationDirtyFlag())
            model.setMaintenance_duration(domain.getMaintenance_duration());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getModelDirtyFlag())
            model.setModel(domain.getModel());
         if(domain.getMaintenance_open_countDirtyFlag())
            model.setMaintenance_open_count(domain.getMaintenance_open_count());
         if(domain.getMessage_is_followerDirtyFlag())
            model.setMessage_is_follower(domain.getMessage_is_follower());
         if(domain.getActivity_stateDirtyFlag())
            model.setActivity_state(domain.getActivity_state());
         if(domain.getActivity_date_deadlineDirtyFlag())
            model.setActivity_date_deadline(domain.getActivity_date_deadline());
         if(domain.getMaintenance_countDirtyFlag())
            model.setMaintenance_count(domain.getMaintenance_count());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getMessage_unread_counterDirtyFlag())
            model.setMessage_unread_counter(domain.getMessage_unread_counter());
         if(domain.getNoteDirtyFlag())
            model.setNote(domain.getNote());
         if(domain.getPartner_refDirtyFlag())
            model.setPartner_ref(domain.getPartner_ref());
         if(domain.getMaintenance_idsDirtyFlag())
            model.setMaintenance_ids(domain.getMaintenance_ids());
         if(domain.getMessage_has_error_counterDirtyFlag())
            model.setMessage_has_error_counter(domain.getMessage_has_error_counter());
         if(domain.getActivity_user_idDirtyFlag())
            model.setActivity_user_id(domain.getActivity_user_id());
         if(domain.getMessage_main_attachment_idDirtyFlag())
            model.setMessage_main_attachment_id(domain.getMessage_main_attachment_id());
         if(domain.getSerial_noDirtyFlag())
            model.setSerial_no(domain.getSerial_no());
         if(domain.getMessage_attachment_countDirtyFlag())
            model.setMessage_attachment_count(domain.getMessage_attachment_count());
         if(domain.getCostDirtyFlag())
            model.setCost(domain.getCost());
         if(domain.getNext_action_dateDirtyFlag())
            model.setNext_action_date(domain.getNext_action_date());
         if(domain.getAssign_dateDirtyFlag())
            model.setAssign_date(domain.getAssign_date());
         if(domain.getEffective_dateDirtyFlag())
            model.setEffective_date(domain.getEffective_date());
         if(domain.getMessage_needactionDirtyFlag())
            model.setMessage_needaction(domain.getMessage_needaction());
         if(domain.getMessage_channel_idsDirtyFlag())
            model.setMessage_channel_ids(domain.getMessage_channel_ids());
         if(domain.getActiveDirtyFlag())
            model.setActive(domain.getActive());
         if(domain.getMessage_idsDirtyFlag())
            model.setMessage_ids(domain.getMessage_ids());
         if(domain.getScrap_dateDirtyFlag())
            model.setScrap_date(domain.getScrap_date());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getMessage_follower_idsDirtyFlag())
            model.setMessage_follower_ids(domain.getMessage_follower_ids());
         if(domain.getPeriodDirtyFlag())
            model.setPeriod(domain.getPeriod());
         if(domain.getMessage_has_errorDirtyFlag())
            model.setMessage_has_error(domain.getMessage_has_error());
         if(domain.getActivity_type_idDirtyFlag())
            model.setActivity_type_id(domain.getActivity_type_id());
         if(domain.getColorDirtyFlag())
            model.setColor(domain.getColor());
         if(domain.getMessage_partner_idsDirtyFlag())
            model.setMessage_partner_ids(domain.getMessage_partner_ids());
         if(domain.getDepartment_id_textDirtyFlag())
            model.setDepartment_id_text(domain.getDepartment_id_text());
         if(domain.getEmployee_id_textDirtyFlag())
            model.setEmployee_id_text(domain.getEmployee_id_text());
         if(domain.getTechnician_user_id_textDirtyFlag())
            model.setTechnician_user_id_text(domain.getTechnician_user_id_text());
         if(domain.getCompany_id_textDirtyFlag())
            model.setCompany_id_text(domain.getCompany_id_text());
         if(domain.getCategory_id_textDirtyFlag())
            model.setCategory_id_text(domain.getCategory_id_text());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getPartner_id_textDirtyFlag())
            model.setPartner_id_text(domain.getPartner_id_text());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getOwner_user_id_textDirtyFlag())
            model.setOwner_user_id_text(domain.getOwner_user_id_text());
         if(domain.getMaintenance_team_id_textDirtyFlag())
            model.setMaintenance_team_id_text(domain.getMaintenance_team_id_text());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
         if(domain.getTechnician_user_idDirtyFlag())
            model.setTechnician_user_id(domain.getTechnician_user_id());
         if(domain.getPartner_idDirtyFlag())
            model.setPartner_id(domain.getPartner_id());
         if(domain.getCategory_idDirtyFlag())
            model.setCategory_id(domain.getCategory_id());
         if(domain.getEmployee_idDirtyFlag())
            model.setEmployee_id(domain.getEmployee_id());
         if(domain.getMaintenance_team_idDirtyFlag())
            model.setMaintenance_team_id(domain.getMaintenance_team_id());
         if(domain.getCompany_idDirtyFlag())
            model.setCompany_id(domain.getCompany_id());
         if(domain.getOwner_user_idDirtyFlag())
            model.setOwner_user_id(domain.getOwner_user_id());
         if(domain.getDepartment_idDirtyFlag())
            model.setDepartment_id(domain.getDepartment_id());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
        return model ;
    }

    public Maintenance_equipment convert2Domain( Imaintenance_equipment model ,Maintenance_equipment domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Maintenance_equipment();
        }

        if(model.getActivity_summaryDirtyFlag())
            domain.setActivity_summary(model.getActivity_summary());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getActivity_idsDirtyFlag())
            domain.setActivity_ids(model.getActivity_ids());
        if(model.getMessage_needaction_counterDirtyFlag())
            domain.setMessage_needaction_counter(model.getMessage_needaction_counter());
        if(model.getMessage_unreadDirtyFlag())
            domain.setMessage_unread(model.getMessage_unread());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getEquipment_assign_toDirtyFlag())
            domain.setEquipment_assign_to(model.getEquipment_assign_to());
        if(model.getLocationDirtyFlag())
            domain.setLocation(model.getLocation());
        if(model.getWarranty_dateDirtyFlag())
            domain.setWarranty_date(model.getWarranty_date());
        if(model.getWebsite_message_idsDirtyFlag())
            domain.setWebsite_message_ids(model.getWebsite_message_ids());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getMaintenance_durationDirtyFlag())
            domain.setMaintenance_duration(model.getMaintenance_duration());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getModelDirtyFlag())
            domain.setModel(model.getModel());
        if(model.getMaintenance_open_countDirtyFlag())
            domain.setMaintenance_open_count(model.getMaintenance_open_count());
        if(model.getMessage_is_followerDirtyFlag())
            domain.setMessage_is_follower(model.getMessage_is_follower());
        if(model.getActivity_stateDirtyFlag())
            domain.setActivity_state(model.getActivity_state());
        if(model.getActivity_date_deadlineDirtyFlag())
            domain.setActivity_date_deadline(model.getActivity_date_deadline());
        if(model.getMaintenance_countDirtyFlag())
            domain.setMaintenance_count(model.getMaintenance_count());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getMessage_unread_counterDirtyFlag())
            domain.setMessage_unread_counter(model.getMessage_unread_counter());
        if(model.getNoteDirtyFlag())
            domain.setNote(model.getNote());
        if(model.getPartner_refDirtyFlag())
            domain.setPartner_ref(model.getPartner_ref());
        if(model.getMaintenance_idsDirtyFlag())
            domain.setMaintenance_ids(model.getMaintenance_ids());
        if(model.getMessage_has_error_counterDirtyFlag())
            domain.setMessage_has_error_counter(model.getMessage_has_error_counter());
        if(model.getActivity_user_idDirtyFlag())
            domain.setActivity_user_id(model.getActivity_user_id());
        if(model.getMessage_main_attachment_idDirtyFlag())
            domain.setMessage_main_attachment_id(model.getMessage_main_attachment_id());
        if(model.getSerial_noDirtyFlag())
            domain.setSerial_no(model.getSerial_no());
        if(model.getMessage_attachment_countDirtyFlag())
            domain.setMessage_attachment_count(model.getMessage_attachment_count());
        if(model.getCostDirtyFlag())
            domain.setCost(model.getCost());
        if(model.getNext_action_dateDirtyFlag())
            domain.setNext_action_date(model.getNext_action_date());
        if(model.getAssign_dateDirtyFlag())
            domain.setAssign_date(model.getAssign_date());
        if(model.getEffective_dateDirtyFlag())
            domain.setEffective_date(model.getEffective_date());
        if(model.getMessage_needactionDirtyFlag())
            domain.setMessage_needaction(model.getMessage_needaction());
        if(model.getMessage_channel_idsDirtyFlag())
            domain.setMessage_channel_ids(model.getMessage_channel_ids());
        if(model.getActiveDirtyFlag())
            domain.setActive(model.getActive());
        if(model.getMessage_idsDirtyFlag())
            domain.setMessage_ids(model.getMessage_ids());
        if(model.getScrap_dateDirtyFlag())
            domain.setScrap_date(model.getScrap_date());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getMessage_follower_idsDirtyFlag())
            domain.setMessage_follower_ids(model.getMessage_follower_ids());
        if(model.getPeriodDirtyFlag())
            domain.setPeriod(model.getPeriod());
        if(model.getMessage_has_errorDirtyFlag())
            domain.setMessage_has_error(model.getMessage_has_error());
        if(model.getActivity_type_idDirtyFlag())
            domain.setActivity_type_id(model.getActivity_type_id());
        if(model.getColorDirtyFlag())
            domain.setColor(model.getColor());
        if(model.getMessage_partner_idsDirtyFlag())
            domain.setMessage_partner_ids(model.getMessage_partner_ids());
        if(model.getDepartment_id_textDirtyFlag())
            domain.setDepartment_id_text(model.getDepartment_id_text());
        if(model.getEmployee_id_textDirtyFlag())
            domain.setEmployee_id_text(model.getEmployee_id_text());
        if(model.getTechnician_user_id_textDirtyFlag())
            domain.setTechnician_user_id_text(model.getTechnician_user_id_text());
        if(model.getCompany_id_textDirtyFlag())
            domain.setCompany_id_text(model.getCompany_id_text());
        if(model.getCategory_id_textDirtyFlag())
            domain.setCategory_id_text(model.getCategory_id_text());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getPartner_id_textDirtyFlag())
            domain.setPartner_id_text(model.getPartner_id_text());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getOwner_user_id_textDirtyFlag())
            domain.setOwner_user_id_text(model.getOwner_user_id_text());
        if(model.getMaintenance_team_id_textDirtyFlag())
            domain.setMaintenance_team_id_text(model.getMaintenance_team_id_text());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        if(model.getTechnician_user_idDirtyFlag())
            domain.setTechnician_user_id(model.getTechnician_user_id());
        if(model.getPartner_idDirtyFlag())
            domain.setPartner_id(model.getPartner_id());
        if(model.getCategory_idDirtyFlag())
            domain.setCategory_id(model.getCategory_id());
        if(model.getEmployee_idDirtyFlag())
            domain.setEmployee_id(model.getEmployee_id());
        if(model.getMaintenance_team_idDirtyFlag())
            domain.setMaintenance_team_id(model.getMaintenance_team_id());
        if(model.getCompany_idDirtyFlag())
            domain.setCompany_id(model.getCompany_id());
        if(model.getOwner_user_idDirtyFlag())
            domain.setOwner_user_id(model.getOwner_user_id());
        if(model.getDepartment_idDirtyFlag())
            domain.setDepartment_id(model.getDepartment_id());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        return domain ;
    }


}
